﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace TB_CS.Rate
{
    public partial class Rate_Show : Form
    {
        public static string Tid_List = "";
        public Rate_Show(String Tid)
        {
            InitializeComponent();
            Tid_List = Tid;
        }

        private void Rate_Show_Load(object sender, EventArgs e)
        {
            this.KeyPreview = true;
            this.Text = "订单号：" + Tid_List;
            richTextBox1.Text = Class.SysInfo.WS_TOP.Get_Rate_Feed(Tid_List.Trim().ToString(),
                Class.SysInfo.INFO_Seller_Nick.ToString());
            textBox2.Text = Class.SysInfo.Get_Return_Rate();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            DataSet DINGTALK_DST = Class.SysInfo.WS_TOP.GET_DINGTALK_OPEN_INFO(Class.SysInfo.INFO_Seller_Nick.ToString());

            LeShiTao_Library.DingTalk.Query_Message.Send_QY_TEXT_Message(LeShiTao_Library.DingTalk.HTTP.GET_ACCESSTOKEN(
                DINGTALK_DST.Tables[0].Rows[0][2].ToString(), DINGTALK_DST.Tables[0].Rows[0][3].ToString()), DINGTALK_DST.Tables[0].Rows[0][4].ToString(), "【评价监测】\n\n" + richTextBox1.Text.Trim().ToString().Split('#')[1].ToString());
            this.Close();
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Class.SysInfo.INSERT_VALUE("RR", textBox2.Text.Trim().ToString());
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Class.SysInfo.WS_TOP.ADD_RATE(Class.SysInfo.INFO_Seller_Nick.ToString(), Tid_List, textBox2.Text.Trim().ToString());
            this.Close();
        }

        private void Rate_Show_KeyDown(object sender, KeyEventArgs e)
        {
            if(e.KeyCode==Keys.Escape)
            {
                this.Close();
            }
        }
    }
}
